Optimal. Leaf size=250 \[ \frac{\left (a^2-b^2\right ) (d \cot (e+f x))^{n+3} \, _2F_1\left (1,\frac{n+3}{2};\frac{n+5}{2};-\cot ^2(e+f x)\right )}{d^3 f (n+3) \left (a^2+b^2\right )^2}+\frac{2 a b (d \cot (e+f x))^{n+4} \, _2F_1\left (1,\frac{n+4}{2};\frac{n+6}{2};-\cot ^2(e+f x)\right )}{d^4 f (n+4) \left (a^2+b^2\right )^2}+\frac{a^2 \left (a^2 (n+2)+b^2 n\right ) (d \cot (e+f x))^{n+3} \, _2F_1\left (1,n+3;n+4;-\frac{a \cot (e+f x)}{b}\right )}{b^2 d^3 f (n+3) \left (a^2+b^2\right )^2}-\frac{a^2 (d \cot (e+f x))^{n+3}}{b d^3 f \left (a^2+b^2\right ) (a \cot (e+f x)+b)} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.777053, antiderivative size = 250, normalized size of antiderivative = 1., number of steps used = 10, number of rules used = 8, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.348, Rules used = {3673, 3569, 3653, 3538, 3476, 364, 3634, 64} \[ \frac{\left (a^2-b^2\right ) (d \cot (e+f x))^{n+3} \, _2F_1\left (1,\frac{n+3}{2};\frac{n+5}{2};-\cot ^2(e+f x)\right )}{d^3 f (n+3) \left (a^2+b^2\right )^2}+\frac{2 a b (d \cot (e+f x))^{n+4} \, _2F_1\left (1,\frac{n+4}{2};\frac{n+6}{2};-\cot ^2(e+f x)\right )}{d^4 f (n+4) \left (a^2+b^2\right )^2}+\frac{a^2 \left (a^2 (n+2)+b^2 n\right ) (d \cot (e+f x))^{n+3} \, _2F_1\left (1,n+3;n+4;-\frac{a \cot (e+f x)}{b}\right )}{b^2 d^3 f (n+3) \left (a^2+b^2\right )^2}-\frac{a^2 (d \cot (e+f x))^{n+3}}{b d^3 f \left (a^2+b^2\right ) (a \cot (e+f x)+b)} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3673
Rule 3569
Rule 3653
Rule 3538
Rule 3476
Rule 364
Rule 3634
Rule 64
Rubi steps
\begin{align*} \int \frac{(d \cot (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx &=\frac{\int \frac{(d \cot (e+f x))^{2+n}}{(b+a \cot (e+f x))^2} \, dx}{d^2}\\ &=-\frac{a^2 (d \cot (e+f x))^{3+n}}{b \left (a^2+b^2\right ) d^3 f (b+a \cot (e+f x))}-\frac{\int \frac{(d \cot (e+f x))^{2+n} \left (-d \left (b^2-a^2 (2+n)\right )+a b d \cot (e+f x)+a^2 d (2+n) \cot ^2(e+f x)\right )}{b+a \cot (e+f x)} \, dx}{b \left (a^2+b^2\right ) d^3}\\ &=-\frac{a^2 (d \cot (e+f x))^{3+n}}{b \left (a^2+b^2\right ) d^3 f (b+a \cot (e+f x))}-\frac{\int (d \cot (e+f x))^{2+n} \left (b \left (a^2-b^2\right ) d+2 a b^2 d \cot (e+f x)\right ) \, dx}{b \left (a^2+b^2\right )^2 d^3}-\frac{\left (a^2 \left (b^2 n+a^2 (2+n)\right )\right ) \int \frac{(d \cot (e+f x))^{2+n} \left (1+\cot ^2(e+f x)\right )}{b+a \cot (e+f x)} \, dx}{b \left (a^2+b^2\right )^2 d^2}\\ &=-\frac{a^2 (d \cot (e+f x))^{3+n}}{b \left (a^2+b^2\right ) d^3 f (b+a \cot (e+f x))}-\frac{(2 a b) \int (d \cot (e+f x))^{3+n} \, dx}{\left (a^2+b^2\right )^2 d^3}-\frac{\left (a^2-b^2\right ) \int (d \cot (e+f x))^{2+n} \, dx}{\left (a^2+b^2\right )^2 d^2}-\frac{\left (a^2 \left (b^2 n+a^2 (2+n)\right )\right ) \operatorname{Subst}\left (\int \frac{(-d x)^{2+n}}{b-a x} \, dx,x,-\cot (e+f x)\right )}{b \left (a^2+b^2\right )^2 d^2 f}\\ &=-\frac{a^2 (d \cot (e+f x))^{3+n}}{b \left (a^2+b^2\right ) d^3 f (b+a \cot (e+f x))}+\frac{a^2 \left (b^2 n+a^2 (2+n)\right ) (d \cot (e+f x))^{3+n} \, _2F_1\left (1,3+n;4+n;-\frac{a \cot (e+f x)}{b}\right )}{b^2 \left (a^2+b^2\right )^2 d^3 f (3+n)}+\frac{(2 a b) \operatorname{Subst}\left (\int \frac{x^{3+n}}{d^2+x^2} \, dx,x,d \cot (e+f x)\right )}{\left (a^2+b^2\right )^2 d^2 f}+\frac{\left (a^2-b^2\right ) \operatorname{Subst}\left (\int \frac{x^{2+n}}{d^2+x^2} \, dx,x,d \cot (e+f x)\right )}{\left (a^2+b^2\right )^2 d f}\\ &=-\frac{a^2 (d \cot (e+f x))^{3+n}}{b \left (a^2+b^2\right ) d^3 f (b+a \cot (e+f x))}+\frac{\left (a^2-b^2\right ) (d \cot (e+f x))^{3+n} \, _2F_1\left (1,\frac{3+n}{2};\frac{5+n}{2};-\cot ^2(e+f x)\right )}{\left (a^2+b^2\right )^2 d^3 f (3+n)}+\frac{a^2 \left (b^2 n+a^2 (2+n)\right ) (d \cot (e+f x))^{3+n} \, _2F_1\left (1,3+n;4+n;-\frac{a \cot (e+f x)}{b}\right )}{b^2 \left (a^2+b^2\right )^2 d^3 f (3+n)}+\frac{2 a b (d \cot (e+f x))^{4+n} \, _2F_1\left (1,\frac{4+n}{2};\frac{6+n}{2};-\cot ^2(e+f x)\right )}{\left (a^2+b^2\right )^2 d^4 f (4+n)}\\ \end{align*}
Mathematica [A] time = 0.797023, size = 192, normalized size = 0.77 \[ -\frac{\cot ^3(e+f x) (d \cot (e+f x))^n \left (b^2 (n+4) \left (b^2-a^2\right ) \, _2F_1\left (1,\frac{n+3}{2};\frac{n+5}{2};-\cot ^2(e+f x)\right )+a \left (a (n+4) \left (a^2+b^2\right ) \, _2F_1\left (2,n+3;n+4;-\frac{a \cot (e+f x)}{b}\right )+2 a b^2 (n+4) \, _2F_1\left (1,n+3;n+4;-\frac{a \cot (e+f x)}{b}\right )-2 b^3 (n+3) \cot (e+f x) \, _2F_1\left (1,\frac{n+4}{2};\frac{n+6}{2};-\cot ^2(e+f x)\right )\right )\right )}{b^2 f (n+3) (n+4) \left (a^2+b^2\right )^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F] time = 0.306, size = 0, normalized size = 0. \begin{align*} \int{\frac{ \left ( d\cot \left ( fx+e \right ) \right ) ^{n}}{ \left ( a+b\tan \left ( fx+e \right ) \right ) ^{2}}}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\left (d \cot \left (f x + e\right )\right )^{n}}{{\left (b \tan \left (f x + e\right ) + a\right )}^{2}}\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F] time = 0., size = 0, normalized size = 0. \begin{align*}{\rm integral}\left (\frac{\left (d \cot \left (f x + e\right )\right )^{n}}{b^{2} \tan \left (f x + e\right )^{2} + 2 \, a b \tan \left (f x + e\right ) + a^{2}}, x\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\left (d \cot \left (f x + e\right )\right )^{n}}{{\left (b \tan \left (f x + e\right ) + a\right )}^{2}}\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]